package com.greateamd.timetableasy.domain;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import net.sf.gilead.pojo.gwt.LightEntity;

@SuppressWarnings("serial")
@Entity
@Table(name="rooms")
public class Room extends LightEntity implements PersistableEntity,Serializable{
	
	@Id
	@GeneratedValue
	private Integer id;
	private String name;
	
	@Column(name="enabled",nullable=false)
	private boolean enabled = true;
	
	@ManyToOne
	@JoinColumn(name="campus")
	private Campus campus;
	
	public Room() {
	}
	
	public Room(String name,Campus campus){
		this.name = name;
		this.campus = campus;
	}

	public Integer getId() {
		return id;
	}

	public String getName() {
		return name;
	}

	public Campus getCampus() {
		return campus;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setCampus(Campus campus) {
		this.campus = campus;
	}

	public boolean isEnabled() {
		return enabled;
	}

	public void setEnabled(boolean enabled) {
		this.enabled = enabled;
	}
	
	@Override
	public String toString() {
		return getCampus().getName() + " " +getName();
	}
}
